package com.eaoa.uc.dictionary.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.eaoa.base.EABaseAction;
import com.eaoa.query.pub.PubDditemQuery;
import com.eaoa.uc.dictionary.form.DDictionaryItemCondition;
import com.eaoa.uc.dictionary.form.DDictionaryItemSearchForm;

public class DDictionaryItemSearchAction extends EABaseAction{


	/**
	 * DDictionaryItem Search
	 */
	protected ActionForward doWork(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
				
		DDictionaryItemSearchForm sform = (DDictionaryItemSearchForm) form;
		sform.initConditionPost();
		DDictionaryItemCondition condition = (DDictionaryItemCondition) sform.getCondition();
		PubDditemQuery query = new PubDditemQuery();		
		query.setItemcode(condition.getItemcode());
		query.setLikeItemname(condition.getItemname());
		query.setPageRange(sform.getPageinfo());
		query.execute();
		request.setAttribute("dictionaryItems", query.getResults());
		return mapping.findForward("success");		
	}
}